home *** CD-ROM | disk | FTP | other *** search
/ SGI Freeware 1999 August / SGI Freeware 1999 August.iso / dist / fw_xemacs.idb / usr / freeware / lib / xemacs-20.4 / lisp / prim / scrollbar.el.z / scrollbar.el
Encoding:
Text File  |  1998-05-21  |  4.2 KB  |  112 lines

  1. ;; Scrollbar support.
  2. ;; Copyright (C) 1995 Board of Trustees, University of Illinois
  3.  
  4. ;; This file is part of XEmacs.
  5.  
  6. ;; XEmacs is free software; you can redistribute it and/or modify it
  7. ;; under the terms of the GNU General Public License as published by
  8. ;; the Free Software Foundation; either version 2, or (at your option)
  9. ;; any later version.
  10.  
  11. ;; XEmacs is distributed in the hope that it will be useful, but
  12. ;; WITHOUT ANY WARRANTY; without even the implied warranty of
  13. ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  14. ;; General Public License for more details.
  15.  
  16. ;; You should have received a copy of the GNU General Public License
  17. ;; along with XEmacs; see the file COPYING.  If not, write to the 
  18. ;; Free Software Foundation, 59 Temple Place - Suite 330,
  19. ;; Boston, MA 02111-1307, USA.
  20.  
  21. ;;; Synched up with: Not in FSF. (Completely divergent from FSF scroll-bar.el)
  22.  
  23. (defun init-scrollbar-from-resources (locale)
  24.   (when (and (featurep 'x)
  25.          (or (eq locale 'global)
  26.          (eq 'x (device-or-frame-type locale))))
  27.     (x-init-scrollbar-from-resources locale)))
  28.  
  29. ;;
  30. ;; vertical scrollbar functions
  31. ;;
  32.  
  33. ;;; ### Move functions from C into Lisp here!
  34.  
  35. ;;
  36. ;; horizontal scrollbar functions
  37. ;;
  38.  
  39. (defun scrollbar-char-left (window)
  40.   "Function called when the char-left arrow on the scrollbar is clicked.
  41. This is the little arrow to the left of the scrollbar.  One argument is
  42. passed, the scrollbar's window.  You can advise this function to
  43. change the scrollbar behavior."
  44.   (when (window-live-p window)
  45.     (scrollbar-set-hscroll window (- (window-hscroll window) 1))
  46.     (setq zmacs-region-stays t)
  47.     nil))
  48.  
  49. (defun scrollbar-char-right (window)
  50.   "Function called when the char-right arrow on the scrollbar is clicked.
  51. This is the little arrow to the right of the scrollbar.  One argument is
  52. passed, the scrollbar's window.  You can advise this function to
  53. change the scrollbar behavior."
  54.   (when (window-live-p window)
  55.     (scrollbar-set-hscroll window (+ (window-hscroll window) 1))
  56.     (setq zmacs-region-stays t)
  57.     nil))
  58.  
  59. (defun scrollbar-page-left (window)
  60.   "Function called when the user gives the \"page-left\" scrollbar action.
  61. \(The way this is done can vary from scrollbar to scrollbar.\) One argument is
  62. passed, the scrollbar's window.  You can advise this function to
  63. change the scrollbar behavior."
  64.   (when (window-live-p window)
  65.     (scrollbar-set-hscroll window (- (window-hscroll window)
  66.                      (- (window-width window) 2)))
  67.     (setq zmacs-region-stays t)
  68.     nil))
  69.  
  70. (defun scrollbar-page-right (window)
  71.   "Function called when the user gives the \"page-right\" scrollbar action.
  72. \(The way this is done can vary from scrollbar to scrollbar.\) One argument is
  73. passed, the scrollbar's window.  You can advise this function to
  74. change the scrollbar behavior."
  75.   (when (window-live-p window)
  76.     (scrollbar-set-hscroll window (+ (window-hscroll window)
  77.                      (- (window-width window) 2)))
  78.     (setq zmacs-region-stays t)
  79.     nil))
  80.  
  81. (defun scrollbar-to-left (window)
  82.   "Function called when the user gives the \"to-left\" scrollbar action.
  83. \(The way this is done can vary from scrollbar to scrollbar.\). One argument is
  84. passed, the scrollbar's window.  You can advise this function to
  85. change the scrollbar behavior."
  86.   (when (window-live-p window)
  87.     (scrollbar-set-hscroll window 0)
  88.     (setq zmacs-region-stays t)
  89.     nil))
  90.  
  91. (defun scrollbar-to-right (window)
  92.   "Function called when the user gives the \"to-right\" scrollbar action.
  93. \(The way this is done can vary from scrollbar to scrollbar.\). One argument is
  94. passed, the scrollbar's window.  You can advise this function to
  95. change the scrollbar behavior."
  96.   (when (window-live-p window)
  97.     (scrollbar-set-hscroll window 'max)
  98.     (setq zmacs-region-stays t)
  99.     nil))
  100.  
  101. (defun scrollbar-horizontal-drag (data)
  102.   "Function called when the user drags the horizontal scrollbar thumb.
  103. One argument is passed, a cons containing the scrollbar's window and a value
  104. representing how many columns the thumb is slid over.  You can advise
  105. this function to change the scrollbar behavior."
  106.   (let ((window (car data))
  107.     (value  (cdr data)))
  108.     (when (and (window-live-p window) (integerp value))
  109.       (scrollbar-set-hscroll window value)
  110.       (setq zmacs-region-stays t)
  111.       nil)))
  112.